home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / doc / interpreter / arith.tex next >
Text File  |  1997-08-13  |  20KB  |  816 lines

  1. @c Copyright (C) 1996, 1997 John W. Eaton
  2. @c This is part of the Octave manual.
  3. @c For copying conditions, see the file gpl.tex.
  4.  
  5. @node Arithmetic, Linear Algebra, Matrix Manipulation, Top
  6. @chapter Arithmetic
  7.  
  8. Unless otherwise noted, all of the functions described in this chapter
  9. will work for real and complex scalar or matrix arguments.
  10.  
  11. @menu
  12. * Utility Functions::           
  13. * Complex Arithmetic::          
  14. * Trigonometry::                
  15. * Sums and Products::           
  16. * Special Functions::           
  17. * Mathematical Constants::      
  18. @end menu
  19.  
  20. @node Utility Functions, Complex Arithmetic, Arithmetic, Arithmetic
  21. @section Utility Functions
  22.  
  23. The following functions are available for working with complex numbers.
  24. Each expects a single argument.  They are called @dfn{mapping functions}
  25. because when given a matrix argument, they apply the given function to
  26. each element of the matrix.
  27.  
  28. @deftypefn {Mapping Function} {} ceil (@var{x})
  29. Return the smallest integer not less than @var{x}.  If @var{x} is
  30. complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.
  31. @end deftypefn
  32.  
  33. @deftypefn {Mapping Function} {} exp (@var{x})
  34. Compute the exponential of @var{x}.  To compute the matrix exponential,
  35. see @ref{Linear Algebra}.
  36. @end deftypefn
  37.  
  38. @deftypefn {Mapping Function} {} fix (@var{x})
  39. Truncate @var{x} toward zero.  If @var{x} is complex, return
  40. @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.
  41. @end deftypefn
  42.  
  43. @deftypefn {Mapping Function} {} floor (@var{x})
  44. Return the largest integer not greater than @var{x}.  If @var{x} is
  45. complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.
  46. @end deftypefn
  47.  
  48. @deftypefn {Mapping Function} {} gcd (@var{x}, @code{...})
  49. Compute the greatest common divisor of the elements of @var{x}, or the
  50. list of all the arguments.  For example, 
  51.  
  52. @example
  53. gcd (a1, ..., ak)
  54. @end example
  55.  
  56. @noindent
  57. is the same as
  58.  
  59. @example
  60. gcd ([a1, ..., ak])
  61. @end example
  62.  
  63. An optional second return value, @var{v}
  64. contains an integer vector such that
  65.  
  66. @example
  67. g = v(1) * a(k) + ... + v(k) * a(k)
  68. @end example
  69. @end deftypefn
  70.  
  71. @deftypefn {Mapping Function} {} lcm (@var{x}, @code{...})
  72. Compute the least common multiple of the elements elements of @var{x}, or
  73. the list of all the arguments.  For example, 
  74.  
  75. @example
  76. lcm (a1, ..., ak)
  77. @end example
  78.  
  79. @noindent
  80. is the same as
  81.  
  82. @example
  83. lcm ([a1, ..., ak]).
  84. @end example
  85. @end deftypefn
  86.  
  87. @deftypefn {Mapping Function} {} log (@var{x})
  88. Compute the natural logarithm of @var{x}.  To compute the matrix logarithm, 
  89. see @ref{Linear Algebra}.
  90. @end deftypefn
  91.  
  92. @deftypefn {Mapping Function} {} log10 (@var{x})
  93. Compute the base-10 logarithm of @var{x}.
  94. @end deftypefn
  95.  
  96. @deftypefn {Mapping Function} {@var{y} =} log2 (@var{x})
  97. @deftypefnx {Mapping Function} {[@var{f}, @var{e}]} log2 (@var{x})
  98. Compute the base-2 logarithm of @var{x}.  With two outputs, returns
  99. @var{f} and @var{e} such that
  100. @iftex
  101. @tex
  102.  $1/2 <= |f| < 1$ and $x = f \cdot 2^e$.
  103. @end tex
  104. @end iftex
  105. @ifinfo
  106.  1/2 <= abs(f) < 1 and x = f * 2^e.
  107. @end ifinfo
  108. @end deftypefn
  109.  
  110. @deftypefn {Loadable Function} {} max (@var{x})
  111. For a vector argument, return the maximum value.  For a matrix argument,
  112. return the maximum value from each column, as a row vector.  Thus,
  113.  
  114. @example
  115. max (max (@var{x}))
  116. @end example
  117.  
  118. @noindent
  119. returns the largest element of @var{x}.
  120.  
  121. For complex arguments, the magnitude of the elements are used for
  122. comparison.
  123. @end deftypefn
  124.  
  125. @deftypefn {Loadable Function} {} min (@var{x})
  126. Like @code{max}, but return the minimum value.
  127. @end deftypefn
  128.  
  129. @deftypefn {Function File} {} nextpow2 (@var{x})
  130. If @var{x} is a scalar, returns the first integer @var{n} such that
  131. @iftex
  132. @tex
  133.  $2^n \ge |x|$.
  134. @end tex
  135. @end iftex
  136. @ifinfo
  137.  2^n >= abs (x).
  138. @end ifinfo
  139.  
  140. If @var{x} is a vector, return @code{nextpow2 (length (@var{x}))}.
  141. @end deftypefn
  142.  
  143. @deftypefn {Mapping Function} {} pow2 (@var{x})
  144. @deftypefnx {Mapping Function} {} pow2 (@var{f}, @var{e})
  145. With one argument, computes
  146. @iftex
  147. @tex
  148.  $2^x$
  149. @end tex
  150. @end iftex
  151. @ifinfo
  152.  2 .^ x
  153. @end ifinfo
  154. for each element of @var{x}.  With two arguments, returns
  155. @iftex
  156. @tex
  157.  $f \cdot 2^e$.
  158. @end tex
  159. @end iftex
  160. @ifinfo
  161.  f .* (2 .^ e).
  162. @end ifinfo
  163. @end deftypefn
  164.  
  165. @deftypefn {Mapping Function} {} rem (@var{x}, @var{y})
  166. Return the remainder of @code{@var{x} / @var{y}}, computed using the
  167. expression
  168.  
  169. @example
  170. x - y .* fix (x ./ y)
  171. @end example
  172.  
  173. An error message is printed if the dimensions of the arguments do not
  174. agree, or if either of the arguments is complex.
  175. @end deftypefn
  176.  
  177. @deftypefn {Mapping Function} {} round (@var{x})
  178. Return the integer nearest to @var{x}.  If @var{x} is complex, return
  179. @code{round (real (@var{x})) + round (imag (@var{x})) * I}.
  180. @end deftypefn
  181.  
  182. @deftypefn {Mapping Function} {} sign (@var{x})
  183. Compute the @dfn{signum} function, which is defined as
  184. @iftex
  185. @tex
  186. $$
  187. {\rm sign} (@var{x}) = \cases{1,&$x>0$;\cr 0,&$x=0$;\cr -1,&$x<0$.\cr}
  188. $$
  189. @end tex
  190. @end iftex
  191. @ifinfo
  192.  
  193. @example
  194.            -1, x < 0;
  195. sign (x) =  0, x = 0;
  196.             1, x > 0.
  197. @end example
  198. @end ifinfo
  199.  
  200. For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.
  201. @end deftypefn
  202.  
  203. @deftypefn {Mapping Function} {} sqrt (@var{x})
  204. Compute the square root of @var{x}.  If @var{x} is negative, a complex
  205. result is returned.  To compute the matrix square root, see
  206. @ref{Linear Algebra}.
  207. @end deftypefn
  208.  
  209. @deftypefn {Mapping Function} {} xor (@var{x}, @var{y})
  210. Return the `exclusive or' of the entries of @var{x} and @var{y}.
  211. For boolean expressions @var{x} and @var{y},
  212. @code{xor (@var{x}, @var{y})} is true if and only if @var{x} or @var{y}
  213. is true, but not if both @var{x} and @var{y} are true.
  214. @end deftypefn
  215.  
  216. @node Complex Arithmetic, Trigonometry, Utility Functions, Arithmetic
  217. @section Complex Arithmetic
  218.  
  219. The following functions are available for working with complex
  220. numbers.  Each expects a single argument.  Given a matrix they work on
  221. an element by element basis.  In the descriptions of the following
  222. functions,
  223. @iftex
  224. @tex
  225. $z$ is the complex number $x + iy$, where $i$ is defined as
  226. $\sqrt{-1}$.
  227. @end tex
  228. @end iftex
  229. @ifinfo
  230. @var{z} is the complex number @var{x} + @var{i}@var{y}, where @var{i} is
  231. defined as @code{sqrt (-1)}.
  232. @end ifinfo
  233.  
  234. @deftypefn {Mapping Function} {} abs (@var{z})
  235. Compute the magnitude of @var{z}, defined as
  236. @iftex
  237. @tex
  238. $|z| = \sqrt{x^2 + y^2}$.
  239. @end tex
  240. @end iftex
  241. @ifinfo
  242. |@var{z}| = @code{sqrt (x^2 + y^2)}.
  243. @end ifinfo
  244.  
  245. For example,
  246.  
  247. @example
  248. @group
  249. abs (3 + 4i)
  250.      @result{} 5
  251. @end group
  252. @end example
  253. @end deftypefn
  254.  
  255. @deftypefn {Mapping Function} {} arg (@var{z})
  256. @deftypefnx {Mapping Function} {} angle (@var{z})
  257. Compute the argument of @var{z}, defined as
  258. @iftex
  259. @tex
  260. $\theta = \tan^{-1}(y/x)$.
  261. @end tex
  262. @end iftex
  263. @ifinfo
  264. @var{theta} = @code{atan (@var{y}/@var{x})}.
  265. @end ifinfo
  266.  
  267. @noindent
  268. in radians. 
  269.  
  270. For example,
  271.  
  272. @example
  273. @group
  274. arg (3 + 4i)
  275.      @result{} 0.92730
  276. @end group
  277. @end example
  278. @end deftypefn
  279.  
  280. @deftypefn {Mapping Function} {} conj (@var{z})
  281. Return the complex conjugate of @var{z}, defined as
  282. @iftex
  283. @tex
  284. $\bar{z} = x - iy$.
  285. @end tex
  286. @end iftex
  287. @ifinfo
  288. @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.
  289. @end ifinfo
  290. @end deftypefn
  291.  
  292. @deftypefn {Mapping Function} {} imag (@var{z})
  293. Return the imaginary part of @var{z} as a real number.
  294. @end deftypefn
  295.  
  296. @deftypefn {Mapping Function} {} real (@var{z})
  297. Return the real part of @var{z}.
  298. @end deftypefn
  299.  
  300. @node Trigonometry, Sums and Products, Complex Arithmetic, Arithmetic
  301. @section Trigonometry
  302.  
  303. Octave provides the following trigonometric functions:
  304.  
  305. @deftypefn {Mapping Function} {} sin (@var{z})
  306. @deftypefnx {Mapping Function} {} cos (@var{z})
  307. @deftypefnx {Mapping Function} {} tan (@var{z})
  308. @deftypefnx {Mapping Function} {} sec (@var{z})
  309. @deftypefnx {Mapping Function} {} csc (@var{z})
  310. @deftypefnx {Mapping Function} {} cot (@var{z})
  311. The ordinary trigonometric functions.
  312. @end deftypefn
  313.  
  314. @deftypefn {Mapping Function} {} asin (@var{z})
  315. @deftypefnx {Mapping Function} {} acos (@var{z})
  316. @deftypefnx {Mapping Function} {} atan (@var{z})
  317. @deftypefnx {Mapping Function} {} asec (@var{z})
  318. @deftypefnx {Mapping Function} {} acsc (@var{z})
  319. @deftypefnx {Mapping Function} {} acot (@var{z})
  320. The ordinary inverse trigonometric functions.
  321. @end deftypefn
  322.  
  323. @deftypefn {Mapping Function} {} sinh (@var{z})
  324. @deftypefnx {Mapping Function} {} cosh (@var{z})
  325. @deftypefnx {Mapping Function} {} tanh (@var{z})
  326. @deftypefnx {Mapping Function} {} sech (@var{z})
  327. @deftypefnx {Mapping Function} {} csch (@var{z})
  328. @deftypefnx {Mapping Function} {} coth (@var{z})
  329. Hyperbolic trigonometric functions.
  330. @end deftypefn
  331.  
  332. @deftypefn {Mapping Function} {} asinh (@var{z})
  333. @deftypefnx {Mapping Function} {} acosh (@var{z})
  334. @deftypefnx {Mapping Function} {} atanh (@var{z})
  335. @deftypefnx {Mapping Function} {} asech (@var{z})
  336. @deftypefnx {Mapping Function} {} acsch (@var{z})
  337. @deftypefnx {Mapping Function} {} acoth (@var{z})
  338. Inverse hyperbolic trigonometric functions.
  339. @end deftypefn
  340.  
  341. Each of these functions expect a single argument.  For matrix arguments,
  342. they work on an element by element basis.  For example,
  343.  
  344. @example
  345. @group
  346. sin ([1, 2; 3, 4])
  347.      @result{}  0.84147   0.90930
  348.          0.14112  -0.75680
  349. @end group
  350. @end example
  351.  
  352. @deftypefn {Mapping Function} {} atan2 (@var{y}, @var{x})
  353. Return the arctangent of @var{y}/@var{x}.  The signs of the arguments
  354. are used to determine the quadrant of the result, which is in the range
  355. @iftex
  356. @tex
  357. $\pi$ to $-\pi$.
  358. @end tex
  359. @end iftex
  360. @ifinfo
  361. @code{pi} to -@code{pi}.
  362. @end ifinfo
  363. @end deftypefn
  364.  
  365. @node Sums and Products, Special Functions, Trigonometry, Arithmetic
  366. @section Sums and Products
  367.  
  368. @deftypefn {Built-in Function} {} sum (@var{x})
  369. For a vector argument, return the sum of all the elements.  For a matrix
  370. argument, return the sum of the elements in each column, as a row
  371. vector.  The sum of an empty matrix is 0 if it has no columns, or a
  372. vector of zeros if it has no rows (@pxref{Empty Matrices}).
  373. @end deftypefn
  374.  
  375. @deftypefn {Built-in Function} {} prod (@var{x})
  376. For a vector argument, return the product of all the elements.  For a
  377. matrix argument, return the product of the elements in each column, as a
  378. row vector.  The product of an empty matrix is 1 if it has no columns,
  379. or a vector of ones if it has no rows (@pxref{Empty Matrices}).
  380. @end deftypefn
  381.  
  382. @deftypefn {Built-in Function} {} cumsum (@var{x})
  383. Return the cumulative sum of each column of @var{x}.  For example,
  384.  
  385. @example
  386. @group
  387. cumsum ([1, 2; 3, 4])
  388.      @result{}  1  2
  389.          4  6
  390. @end group
  391. @end example
  392. @end deftypefn
  393.  
  394. @deftypefn {Built-in Function} {} cumprod (@var{x})
  395. Return the cumulative product of each column of @var{x}.  For example,
  396.  
  397. @example
  398. @group
  399. cumprod ([1, 2; 3, 4])
  400.      @result{}  1  2
  401.          3  8
  402. @end group
  403. @end example
  404. @end deftypefn
  405.  
  406. @deftypefn {Built-in Function} {} sumsq (@var{x})
  407. For a vector argument, return the sum of the squares of all the
  408. elements.  For a matrix argument, return the sum of the squares of the
  409. elements in each column, as a row vector.
  410. @end deftypefn
  411.  
  412. @node Special Functions, Mathematical Constants, Sums and Products, Arithmetic
  413. @section Special Functions
  414.  
  415. @deftypefn {Mapping Function} {} beta (@var{a}, @var{b})
  416. Return the Beta function,
  417. @iftex
  418. @tex
  419. $$
  420.  B (a, b) = {\Gamma (a) \Gamma (b) \over \Gamma (a + b)}.
  421. $$
  422. @end tex
  423. @end iftex
  424. @ifinfo
  425.  
  426. @example
  427. beta (a, b) = gamma (a) * gamma (b) / gamma (a + b).
  428. @end example
  429. @end ifinfo
  430. @end deftypefn
  431.  
  432. @deftypefn {Mapping Function} {} betai (@var{a}, @var{b}, @var{x})
  433. Return the incomplete Beta function,
  434. @iftex
  435. @tex
  436. $$
  437.  \beta (a, b, x) = B (a, b)^{-1} \int_0^x t^{(a-z)} (1-t)^{(b-1)} dt.
  438. $$
  439. @end tex
  440. @end iftex
  441. @ifinfo
  442.  
  443. @smallexample
  444.                                     x
  445.                                    /
  446. betai (a, b, x) = beta (a, b)^(-1) | t^(a-1) (1-t)^(b-1) dt.
  447.                                    /
  448.                                 t=0
  449. @end smallexample
  450. @end ifinfo
  451.  
  452. If x has more than one component, both @var{a} and @var{b} must be
  453. scalars.  If @var{x} is a scalar, @var{a} and @var{b} must be of
  454. compatible dimensions.
  455. @end deftypefn
  456.  
  457. @deftypefn {Mapping Function} {} bincoeff (@var{n}, @var{k})
  458. Return the binomial coefficient of @var{n} and @var{k}, defined as
  459. @iftex
  460. @tex
  461. $$
  462.  {n \choose k} = {n (n-1) (n-2) \cdots (n-k+1) \over k!}
  463. $$
  464. @end tex
  465. @end iftex
  466. @ifinfo
  467.  
  468. @example
  469. @group
  470.  /   \
  471.  | n |    n (n-1) (n-2) ... (n-k+1)
  472.  |   |  = -------------------------
  473.  | k |               k!
  474.  \   /
  475. @end group
  476. @end example
  477. @end ifinfo
  478.  
  479. For example,
  480.  
  481. @example
  482. @group
  483. bincoeff (5, 2)
  484.      @result{} 10
  485. @end group
  486. @end example
  487. @end deftypefn
  488.  
  489. @deftypefn {Mapping Function} {} erf (@var{z})
  490. Computes the error function,
  491. @iftex
  492. @tex
  493. $$
  494.  {\rm erf} (z) = {2 \over \sqrt{\pi}}\int_0^z e^{-t^2} dt
  495. $$
  496. @end tex
  497. @end iftex
  498. @ifinfo
  499.  
  500. @smallexample
  501.                          z
  502.                         /
  503. erf (z) = (2/sqrt (pi)) | e^(-t^2) dt
  504.                         /
  505.                      t=0
  506. @end smallexample
  507. @end ifinfo
  508. @end deftypefn
  509.  
  510. @deftypefn {Mapping Function} {} erfc (@var{z})
  511. Computes the complementary error function,
  512. @iftex
  513. @tex
  514. $1 - {\rm erf} (z)$.
  515. @end tex
  516. @end iftex
  517. @ifinfo
  518. @code{1 - erf (@var{z})}.
  519. @end ifinfo
  520. @end deftypefn
  521.  
  522. @deftypefn {Mapping Function} {} erfinv (@var{z})
  523. Computes the inverse of the error function,
  524. @end deftypefn
  525.  
  526. @deftypefn {Mapping Function} {} gamma (@var{z})
  527. Computes the Gamma function,
  528. @iftex
  529. @tex
  530. $$
  531.  \Gamma (z) = \int_0^\infty t^{z-1} e^{-t} dt.
  532. $$
  533. @end tex
  534. @end iftex
  535. @ifinfo
  536.  
  537. @example
  538.             infinity
  539.             /
  540. gamma (z) = | t^(z-1) exp (-t) dt.
  541.             /
  542.          t=0
  543. @end example
  544. @end ifinfo
  545. @end deftypefn
  546.  
  547. @deftypefn {Mapping Function} {} gammai (@var{a}, @var{x})
  548. Computes the incomplete gamma function,
  549. @iftex
  550. @tex
  551. $$
  552.  \gamma (a, x) = {\displaystyle\int_0^x e^{-t} t^{a-1} dt \over \Gamma (a)}
  553. $$
  554. @end tex
  555. @end iftex
  556. @ifinfo
  557.  
  558. @smallexample
  559.                               x
  560.                     1        /
  561. gammai (a, x) = ---------    | exp (-t) t^(a-1) dt
  562.                 gamma (a)    /
  563.                           t=0
  564. @end smallexample
  565. @end ifinfo
  566.  
  567. If @var{a} is scalar, then @code{gammai (@var{a}, @var{x})} is returned
  568. for each element of @var{x} and vice versa.
  569.  
  570. If neither @var{a} nor @var{x} is scalar, the sizes of @var{a} and
  571. @var{x} must agree, and @var{gammai} is applied element-by-element.
  572. @end deftypefn
  573.  
  574. @deftypefn {Mapping Function} {} lgamma (@var{a}, @var{x})
  575. @deftypefnx {Mapping Function} {} gammaln (@var{a}, @var{x})
  576. Return the natural logarithm of the gamma function.
  577. @end deftypefn
  578.  
  579. @deftypefn {Function File} {} cross (@var{x}, @var{y})
  580. Computes the vector cross product of the two 3-dimensional vectors
  581. @var{x} and @var{y}.  For example,
  582.  
  583. @example
  584. @group
  585. cross ([1,1,0], [0,1,1])
  586.      @result{} [ 1; -1; 1 ]
  587. @end group
  588. @end example
  589. @end deftypefn
  590.  
  591. @deftypefn {Function File} {} commutation_matrix (@var{m}, @var{n})
  592. Return the commutation matrix
  593. @iftex
  594. @tex
  595.  $K_{m,n}$
  596. @end tex
  597. @end iftex
  598. @ifinfo
  599.  K(m,n)
  600. @end ifinfo
  601.  which is the unique
  602. @iftex
  603. @tex
  604.  $m n \times m n$
  605. @end tex
  606. @end iftex
  607. @ifinfo
  608.  @var{m}*@var{n} by @var{m}*@var{n}
  609. @end ifinfo
  610.  matrix such that
  611. @iftex
  612. @tex
  613.  $K_{m,n} \cdot {\rm vec} (A) = {\rm vec} (A^T)$
  614. @end tex
  615. @end iftex
  616. @ifinfo
  617.  @var{K}(@var{m},@var{n}) * vec (@var{A}) = vec (@var{A}')
  618. @end ifinfo
  619.  for all
  620. @iftex
  621. @tex
  622.  $m\times n$
  623. @end tex
  624. @end iftex
  625. @ifinfo
  626.  @var{m} by @var{n}
  627. @end ifinfo
  628.  matrices
  629. @iftex
  630. @tex
  631.  $A$.
  632. @end tex
  633. @end iftex
  634. @ifinfo
  635.  @var{A}.
  636. @end ifinfo
  637.  
  638. If only one argument @var{m} is given,
  639. @iftex
  640. @tex
  641.  $K_{m,m}$
  642. @end tex
  643. @end iftex
  644. @ifinfo
  645.  K(m,m)
  646. @end ifinfo
  647.  is returned.
  648.  
  649. See Magnus and Neudecker (1988), Matrix differential calculus with
  650. applications in statistics and econometrics.
  651. @end deftypefn
  652.  
  653. @deftypefn {Function File} {} duplication_matrix (@var{n})
  654. Return the duplication matrix
  655. @iftex
  656. @tex
  657.  $D_n$
  658. @end tex
  659. @end iftex
  660. @ifinfo
  661.  @var{D}_@var{n}
  662. @end ifinfo
  663.  which is the unique
  664. @iftex
  665. @tex
  666.  $n^2 \times n(n+1)/2$
  667. @end tex
  668. @end iftex
  669. @ifinfo
  670.  @var{n}^2 by @var{n}*(@var{n}+1)/2
  671. @end ifinfo
  672.  matrix such that
  673. @iftex
  674. @tex
  675.  $D_n * {\rm vech} (A) = {\rm vec} (A)$
  676. @end tex
  677. @end iftex
  678. @ifinfo
  679.  @var{D}_@var{n} \cdot vech (@var{A}) = vec (@var{A})
  680. @end ifinfo
  681.  for all symmetric
  682. @iftex
  683. @tex
  684.  $n \times n$
  685. @end tex
  686. @end iftex
  687. @ifinfo
  688.  @var{n} by @var{n}
  689. @end ifinfo
  690.  matrices
  691. @iftex
  692. @tex
  693.  $A$.
  694. @end tex
  695. @end iftex
  696. @ifinfo
  697.  @var{A}.
  698. @end ifinfo
  699.  
  700. See Magnus and Neudecker (1988), Matrix differential calculus with
  701. applications in statistics and econometrics.
  702. @end deftypefn
  703.  
  704. @node Mathematical Constants,  , Special Functions, Arithmetic
  705. @section Mathematical Constants
  706.  
  707. @defvr {Built-in Variable} I
  708. @defvrx {Built-in Variable} J
  709. @defvrx {Built-in Variable} i
  710. @defvrx {Built-in Variable} j
  711. A pure imaginary number, defined as
  712. @iftex
  713. @tex
  714.   $\sqrt{-1}$.
  715. @end tex
  716. @end iftex
  717. @ifinfo
  718.   @code{sqrt (-1)}.
  719. @end ifinfo
  720. The @code{I} and @code{J} forms are true constants, and cannot be
  721. modified.  The @code{i} and @code{j} forms are like ordinary variables,
  722. and may be used for other purposes.  However, unlike other variables,
  723. they once again assume their special predefined values if they are
  724. cleared @xref{Status of Variables}.
  725. @end defvr
  726.  
  727. @defvr {Built-in Variable} Inf
  728. @defvrx {Built-in Variable} inf
  729. Infinity.  This is the result of an operation like 1/0, or an operation
  730. that results in a floating point overflow.
  731. @end defvr
  732.  
  733. @defvr {Built-in Variable} NaN
  734. @defvrx {Built-in Variable} nan
  735. Not a number.  This is the result of an operation like
  736. @iftex
  737. @tex
  738. $0/0$, or $\infty - \infty$,
  739. @end tex
  740. @end iftex
  741. @ifinfo
  742. 0/0, or @samp{Inf - Inf},
  743. @end ifinfo
  744. or any operation with a NaN.
  745. @end defvr
  746.  
  747. @defvr {Built-in Variable} pi
  748. The ratio of the circumference of a circle to its diameter.
  749. Internally, @code{pi} is computed as @samp{4.0 * atan (1.0)}.
  750. @end defvr
  751.  
  752. @defvr {Built-in Variable} e
  753. The base of natural logarithms.  The constant
  754. @iftex
  755. @tex
  756.  $e$
  757. @end tex
  758. @end iftex
  759. @ifinfo
  760.  @var{e}
  761. @end ifinfo
  762.  satisfies the equation
  763. @iftex
  764. @tex
  765.  $\log (e) = 1$.
  766. @end tex
  767. @end iftex
  768. @ifinfo
  769.  @code{log} (@var{e}) = 1.
  770. @end ifinfo
  771. @end defvr
  772.  
  773. @defvr {Built-in Variable} eps
  774. The machine precision.  More precisely, @code{eps} is the largest
  775. relative spacing between any two adjacent numbers in the machine's
  776. floating point system.  This number is obviously system-dependent.  On
  777. machines that support 64 bit IEEE floating point arithmetic, @code{eps}
  778. is approximately
  779. @ifinfo
  780.  2.2204e-16.
  781. @end ifinfo
  782. @iftex
  783. @tex
  784.  $2.2204\times10^{-16}$.
  785. @end tex
  786. @end iftex
  787. @end defvr
  788.  
  789. @defvr {Built-in Variable} realmax
  790. The largest floating point number that is representable.  The actual
  791. value is system-dependent.  On machines that support 64 bit IEEE
  792. floating point arithmetic, @code{realmax} is approximately
  793. @ifinfo
  794.  1.7977e+308
  795. @end ifinfo
  796. @iftex
  797. @tex
  798.  $1.7977\times10^{308}$.
  799. @end tex
  800. @end iftex
  801. @end defvr
  802.  
  803. @defvr {Built-in Variable} realmin
  804. The smallest floating point number that is representable.  The actual
  805. value is system-dependent.  On machines that support 64 bit IEEE
  806. floating point arithmetic, @code{realmin} is approximately
  807. @ifinfo
  808.  2.2251e-308
  809. @end ifinfo
  810. @iftex
  811. @tex
  812.  $2.2251\times10^{-308}$.
  813. @end tex
  814. @end iftex
  815. @end defvr
  816.